package com.globallogic.vkulyk.SSHTool;

import org.junit.*;

import java.io.*;

public class E2E_UserDataMode_ExecuteScript extends SSHToolTester {

	@Before
	public void setup() {
		setVarsFromPropertiesFile("testData/testing.properties");
	}

	@Test
	public void shouldExecuteScript() {
		String outExpected = "Linux";
		ByteArrayOutputStream outActual = new ByteArrayOutputStream();
		System.setOut(new PrintStream(outActual));
		String[] args = {user + ":" + password + "@" + host + ":" + port, "-s", script};
		
		new CLIHandler().run(args);

		String outActualWithRemovedNewLine = outActual.toString().replaceAll(
				"\\n", "");

		Assert.assertEquals("Output not equals.", outExpected,
				outActualWithRemovedNewLine);
		
		System.setOut(null);
	}

}
